<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
     <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <style>

      
    </style>

</head>

<body class="white-bg" style="padding: 0;margin:0">
  <div class="page-heade">
      <h2 class="title_color text-center">修改联系人信息</h2>
    </div>
<form action="" method="post" id="add" class="form-inline">
    <table class="table table-bordered">
        <tr class="info">
            <td class="text-center" colspan="6">经销商联络信息</td>
        </tr>
        <tr>
            <td><label for="contact1">客户联系人1<span class="colorRed">*</span>：</label></td>
            <td><input type="text" name="contact1" id="contact1" value="{$data.contact1}" class="form-control"></td>
            <td><label for="mobile1">手机1<span class="colorRed">*</span>:</label></td>
            <td><input type="text" name="mobile1" id="mobile1" value="{$data.mobile1}" class="form-control"></td>
            <td><label for="phone1">联系电话1<span class="colorRed">*</span>:</label></td>
            <td><input type="text" name="phone1" id="phone1" value="{$data.phone1}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="contact2">客户联系人2</label></td>
            <td><input type="text" name="contact2" id="contact2" value="{$data.contact2}" class="form-control"></td>
            <td><label for="mobile2">手机2</label></td>
            <td><input type="text" name="mobile2" id="mobile2" value="{$data.mobile2}" class="form-control"></td>
            <td><label for="phone2">联系电话2</label></td>
            <td><input type="text" name="phone2" id="phone2" value="{$data.phone2}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="mailaddr">邮寄地址<span class="colorRed">*</span></label></td>
            <td colspan="2"><input type="text" name="mailaddr" id="mailaddr" value="{$data.mailaddr}" class="form-control"></td>
            <td><label for="zipcode">邮编<span class="colorRed">*</span></label></td>
            <td colspan="2"><input type="text" name="zipcode" id="zipcode" value="{$data.zipcode}" class="form-control"></td>
        </tr>
        <tr>
           <td colspan="6">
                  <table class="table table-bordered da_table1">
                <tr class="info text-center">
                    <td>姓名</td>
                    <td>电话</td>
                    <td>手机</td>
                    <td>传真</td>
                    <td>电子邮箱</td>
                    <td>职务</td>
                    <td>
                        <button class="btn btn-success addManInfo">添加</button>
                    </td>
                </tr>
                {volist name="data.ci" id="row"}
                <tr>
                    <td>{$row.name}</td>
                    <td>{$row.phone}</td>
                    <td>{$row.mobile}</td>
                    <td>{$row.fax}</td>
                    <td>{$row.email}</td>
                    <td>{$row.job}</td>
                    <td>
                        {if $row.isdel==1}
                        <button class="btn btn-danger delthis2" data-id="{$row.id}">启用</button>
                        {else}
                        <button class="btn btn-danger delthis2" data-id="{$row.id}">删除</button>
                        {/if}
                    </td>
                </tr>
                {/volist}
            </table>
           </td> 
        </tr>
        <tr class="info font-bold">
            <td colspan="6" class="text-center"> 经销商物流信息</td>
        </tr>
        <tr>
            <td> <label for="">收货地址1<span class="colorRed">*</span>：</label></td>
            <td>  <input type="text" name="lgs_rcv_addr" value="{$data.lgs_rcv_addr}" class="form-control"></td>
            <td>   <label for="">收货人1<span class="colorRed">*</span>:</label></td>
            <td>  <input type="text" name="lgs_rcv_one" value="{$data.lgs_rcv_one}" class="form-control"></td>
            <td>  <label for="">联系电话1<span class="colorRed">*</span>:</label></td>
            <td>  <input type="text" name="lgs_rcv_phone" value="{$data.lgs_rcv_phone}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="">收货地址2</label></td>
            <td><input type="text" name="lgs_rcv_addr2" value="{$data.lgs_rcv_addr2}" class="form-control"></td>
            <td><label for="">收货人2</label></td>
            <td><input type="text" name="lgs_rcv_one2" value="{$data.lgs_rcv_one2}" class="form-control"></td>
            <td><label for="">联系电话2</label></td>
            <td><input type="text" name="lgs_rcv_phone2" value="{$data.lgs_rcv_phone2}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="">收货地址3</label></td>
            <td><input type="text" name="lgs_rcv_addr3" value="{$data.lgs_rcv_addr3}" class="form-control"></td>
            <td> <label for="">收货人3</label></td>
            <td><input type="text" name="lgs_rcv_one3"  value="{$data.lgs_rcv_one3}" class="form-control"></td>
            <td><label for="">联系电话3</label></td>
            <td><input type="text" name="lgs_rcv_phone3"  value="{$data.lgs_rcv_phone3}" class="form-control"></td>
        </tr>
        <tr>
            <td colspan="6" class="info text-center font-bold">经销商财务信息</td>
        </tr>
        <tr>
            <td><label for="legalrepre">法定代表人<span>*</span></label></td>
            <td><input type="text" name="cw_legalrepre" id="legalrepre" value="{$data.cw_legalrepre}" class="form-control"></td>
            <td><label for="lrphone">法人固定电话</label></td>
            <td><input type="text" name="cw_lrphone" id="lrphone" value="{$data.cw_lrphone}" class="form-control"></td>
            <td><label for="lrmobile">法人手机</label></td>
            <td><input type="text" name="cw_lrmobile" id="lrmobile" value="{$data.cw_lrmobile}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="lremail">法人电子邮箱</label></td>
            <td><input type="text" name="cw_lremail" id="lremail" value="{$data.cw_lremail}" class="form-control"></td>
            <td><label for="">纳税资格</label></td>
            <td> <input type="radio" name="cw_qualification" id="optionsRadios5" value="0" {if $data.cw_qualification==0}checked{/if} style="margin-left: 15px">一般纳税人
            <input type="radio" name="cw_qualification" id="optionsRadios6" value="1" {if $data.cw_qualification==1}checked{/if} checked>小规模纳税人</td>
            <td><label for="taxsn">税号<span>*</span></label></td>
            <td><input type="text" name="cw_taxsn" id="taxsn" value="{$data.cw_taxsn}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="bank">开户行<span>*</span></label></td>
            <td><input type="text" name="cw_bank" id="bank" value="{$data.cw_bank}" class="form-control"></td>
            <td><label for="banksn">开户账号<span class="colorRed">*</span></label></td>
            <td><input type="text" name="cw_banksn" id="banksn"  value="{$data.cw_banksn}" class="form-control"></td>
            <td><label for="creditperiod">借用账期</label></td>
            <td><input type="text" name="cw_creditperiod" id="creditperiod" value="{$data.cw_creditperiod}" class="form-control">(天)</td>
        </tr>
        <tr>
            <td><label for="creditlimit">信用额</label></td>
            <td><input type="text" name="cw_creditlimit" id="creditlimit" value="{$data.cw_creditlimit}" class="form-control">(元)</td>
            <td> <label for="cw_mailaddr">邮寄地址<span class="colorRed">*</span></label></td>
            <td><input type="text" name="cw_mailaddr" id="cw_mailaddr" value="{$data.cw_mailaddr}" class="form-control"></td>
            <td><label for="cw_zipcode">邮编</label></td>
            <td><input type="text" name="cw_zipcode" id="cw_zipcode" value="{$data.cw_zipcode}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="cw_contact">财务联系人</label></td>
            <td><input type="text" name="cw_contact" id="cw_contact" value="{$data.cw_contact}" class="form-control"></td>
            <td><label for="cw_phone">财务联系电话<span class="colorRed">*</span></label></td>
            <td><input type="text" name="cw_phone" id="cw_phone" value="{$data.cw_phone}" class="form-control"></td>
            <td><label for="cw_email">财务电子邮箱</label></td>
            <td> <input type="text" name="cw_email" id="cw_email" value="{$data.cw_email}" class="form-control"></td>
        </tr>
        <tr>
           <td colspan="6" class="text-center font-bold info">经销商业务联系资料</td>
        </tr>
        <tr>
            <td><label for="" class="labelTxt">业务联系人<span class="colorRed">*</span></label></td>
            <td><input type="text" name="bs_contact" value="{$data.bs_contact}" class="form-control"></td>
            <td><label for="" class="labelTxt">业务联系固定电话<span  class="colorRed">*</span></label></td>
            <td><input type="text" name="bs_phone"  value="{$data.bs_phone}" class="form-control"></td>
            <td><label for="" class="labelTxt">业务联系手机<span class="colorRed">*</span></label></td>
            <td><input type="text" name="bs_mobile"  value="{$data.bs_mobile}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="" class="labelTxt">业务联系传真<span  class="colorRed">*</span></label></td>
            <td><input type="text" name="bs_fax"  value="{$data.bs_fax}" class="form-control"></td>
            <td><label for="" class="labelTxt">收货单位<span  class="colorRed">*</span></label></td>
            <td><input type="text" name="bs_rcv_unit"  value="{$data.bs_rcv_unit}" class="form-control"></td>
            <td><label for="" class="labelTxt">收货地址<span  class="colorRed">*</span></label></td>
            <td><input type="text" name="bs_rcv_addr"  value="{$data.bs_rcv_addr}" class="form-control"></td>
        </tr>
        <tr>
            <td><label for="" class="labelTxt">收货人<span  class="colorRed">*</span></label></td>
            <td colspan="2"> <input type="text" name="bs_rcv_one"  value="{$data.bs_rcv_one}" class="form-control"></td>
            <td><label for="" class="labelTxt">收货人电话<span  class="colorRed">*</span></label></td>
            <td colspan="2"><input type="text" name="bs_rcv_phone"  value="{$data.bs_rcv_phone}" class="form-control"></td>
        </tr>
    </table>
</form>
<div class="padding-10" style="text-align: center;">
    <button class="btn btn-sm btn-primary" id="tijiao">提交</button>
</div>

<!-- 全局js -->
{include file="Public/footer"}

<!-- 自定义js -->
<script type="text/javascript" src="__STATIC__/layout/js/contabs.js"></script>

<!-- 第三方插件 -->
<script src="__STATIC__/layout/js/plugins/pace/pace.min.js"></script>
<script>

    $(".addManInfo").on("click", function () {
        console.log(1)
        var str = '<tr><td><input type="text" name="jxsll[name][]" class="input1" ></td><td><input name="jxsll[phone1][]" type="text" class="input2" style="width:40px;display:inline-block">-<input type="text" name="jxsll[phone2][]" class="input22" style="width:60px;display:inline-block"></td><td><input type="text" name="jxsll[mobile][]"  class="input21"></td><td><input type="text" name="jxsll[fax1][]" class="input2" style="width:40px;display:inline-block">-<input type="text" name="jxsll[fax2][]" class="input22" style="width:60px;display:inline-block"></td><td><input type="text" name="jxsll[email][]" class="input21" ></td><td><input type="text" name="jxsll[job][]" class="input21" ></td><td><button class="btn btn-danger delthis">删除</button></td></tr>'

        $(this).parents(".da_table1").append(str);
        return false
    })
    $(document).on("click", ".delthis2", function () {
        var id = $(this).data('id')
        var _this = this
        if($(this).text()=='删除'){
            $.ajax({
                type:'post',
                url:'{:url("qiyongContact")}',
                data:{id:id},
                dataType:'json',
                success:function (data) {
                    if(data.success) {
                        $(_this).text('启用')
                    }else{
                        swal({
                            title: data.msg,
                            type: "warning"
                        });
                    }
                }
            })
        }else if($(this).text()=='启用'){
            $.ajax({
                type:'post',
                url:'{:url("delContact")}',
                data:{id:id},
                dataType:'json',
                success:function (data) {
                    if(data.success) {
                        $(_this).text('删除')
                    }else{
                        swal({
                            title: data.msg,
                            type: "warning"
                        });
                    }
                }
            })
        }
        return false
//        $(this).parent().parent().remove();
    })
    $(document).on("click", ".delthis", function () {
        $(this).parent().parent().remove();
    })

    //提交
    $('#tijiao').on('click',function () {
        var form =  $('#add')
        var serial = form.serialize()

        console.log(serial)
        $.ajax({
            'type':'post',
            'url':form.attr('action'),
            'data':serial,
            'dataType':'json',
            'success':function (data) {
                if(data.success){
                    swal({
                        title: data.msg,
                        type: "success"
                    },function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name))
                    });

                }else
                    swal({
                        title: data.msg,
                        type: "warning"
                    });
            }
        })
        return false
    })
</script>

</body>

</html>